<template>
	<view>
		<view :class="(is_single_page == 1 ? 'margin-top-xxxl single-page-top' : '')">
			<!-- 搜索框 -->
			<block v-if="is_single_page == 0">
				<view class="nav-search padding-horizontal-main bg-white"
					:style="'padding-top:'+(status_bar_height+8)+'px;'">
					<component-search @onsearch="search_button_event" :propIsOnEvent="true" :propIsRequired="false"  :propPlaceholder="searchtitle" 
					propPlaceholderClass="#c9c9c9" propBrColor="#e1e1e1" propIconColor="#e1e1e1" propBgColor="#fff"></component-search>
				</view>
			</block>

			<!-- 分类内容 -->
			<view v-if="category_list.length > 0"
				:class="'category-content pr bs-bb '+(category_show_level == 0 ? 'goods-model' : '')"
				:style="'height:calc(100vh - '+(status_bar_height+48)+'px);'" >
				<block v-if="category_show_level == 1">
					<!-- 一级模式 -->
					<view class="model-one padding-sm oh"  >
						<block v-for="(item, index) in category_list" :key="index">
							<view class="content-item padding-sm tc cp" :data-value="item.id" @tap="category_event">
								<view class="content auto bg-white wh-auto border-radius-main">
									<image v-if="(item.icon || null) != null" :src="item.icon" mode="aspectFit"
										class="icon radius"></image>
									<view class="text single-text">{{item.name}}</view>
								</view>
							</view>
						</block>
					</view>
				</block>
				<block v-else>
					<!-- 商品列表模式 -->
					<block v-if="category_show_level == 0">
						<!-- 一级导航 -->
						<view class="top-nav bg-white wh-auto pa br-b scroll-view-horizontal">
							<scroll-view :scroll-x="true" class="ht-auto">
								<block v-for="(item, index) in category_list" :key="index">
									<view :class="'text-size-sm item tc cr-base cp dis-inline-block ' + (nav_active_index == index ? 'cr-main border-color-main fw-b' : '')"
										:data-index="index" :data-itemtwoindex="-1" :data-itemthreeindex="-1" @tap="nav_event" >
										<view
											:class="'icon-content circle br auto ' + (nav_active_index == index ? 'border-color-main' : '')">
											<image
												:src="((item[category_goods_model_icon_field] || null) == null) ? common_static_url+'images.png' : item[category_goods_model_icon_field]"
												mode="aspectFit" class="icon dis-block auto wh-auto ht-auto circle">
											</image>
										</view>
										<view class="margin-top-xs word-warp">{{item.name}}</view>
									</view>
								</block>
							</scroll-view>
						</view>
						<!-- 二级导航 -->
						<view class="left-nav bg-white ht-auto">
							<scroll-view :scroll-y="true" class="ht-auto">
								<view class="left-content-actual">
									<view
										:class="'text-size-sm item tc cr-base cp oh ' + (nav_active_item_two_index == -1 ? 'nav-active cr-main border-color-main' : '')"
										:data-index="nav_active_index" :data-itemtwoindex="-1" :data-itemthreeindex="-1"
										@tap="nav_event">
										<text>{{this.$t('goodscategory.all')}}</text>
									</view>
									<block
										v-if="(data_content || null) != null && (data_content.items || null) != null && data_content.items.length > 0">
										<block v-for="(item, index) in data_content.items" :key="index">
											<view
												:class="'text-size-sm item tc cr-base cp oh ' + (nav_active_item_two_index == index ? 'nav-active cr-main border-color-main' : '')"
												:data-index="nav_active_index" :data-itemtwoindex="index"
												:data-itemthreeindex="-1" @tap="nav_event">
												<text>{{item.name}}</text>
											</view>
										</block>
									</block>
								</view>
							</scroll-view>
						</view>
						<!-- 商品列表 -->
						<view class="goods-right-content pa bs-bb padding-top-main padding-horizontal-main">
							<scroll-view :scroll-y="true" class="ht-auto goods-list" :scroll-top="scroll_top"
								@scroll="scroll_event" @scrolltolower="scroll_lower" lower-threshold="30">
								<view class="right-content-actual pr">
									<!-- 三级导航 -->
									<view
										v-if="(data_three_content || null) != null && (data_three_content.items || null) != null && data_three_content.items.length > 0"
										class="word-list scroll-view-horizontal">
										<scroll-view :scroll-x="true">
											<view
												:class="'word-icon dis-inline-block text-size-sm round padding-top-xs padding-bottom-xs padding-left padding-right '+((nav_active_item_three_index == -1) ? 'bg-main-light br-main-light cr-main' : 'br-gray cr-gray')"
												:data-index="nav_active_index"
												:data-itemtwoindex="nav_active_item_two_index" :data-itemthreeindex="-1"
												@tap="nav_event">{{$t('goodscategory.all')}}</view>
											<block v-for="(item, index) in data_three_content.items" :key="index">
												<view
													:class="'word-icon dis-inline-block text-size-sm round padding-top-xs padding-bottom-xs padding-left padding-right '+((nav_active_item_three_index == index) ? 'bg-main-light br-main-light cr-main' : 'br-gray cr-gray')"
													:data-index="nav_active_index"
													:data-itemtwoindex="nav_active_item_two_index"
													:data-itemthreeindex="index" @tap="nav_event">{{item.name}}</view>
											</block>
										</scroll-view>
									</view>
									<!-- 右侧商品列表 -->
									<view v-if="(data_list || null) != null && data_list.length > 0" class="oh">
										<view v-for="(item, index) in data_list" :key="index"
											class="item bg-white border-radius-main oh pr spacing-mb">
											<view :data-value="item.goods_url+'&is_opt_back=1'" @tap="url_event">
												<image :src="item.images" mode="widthFix" class="goods-img radius fl">
												</image>
												<view class="goods-base padding-top-sm padding-right-sm fr">
													<view class="goods-base-content">
														<view class="goods-title text-size-sm multi-text">{{item.title}}
														</view>
														<view v-if="(item.simple_desc || null) != null"
															class="simple-desc cr-red text-size-xs margin-top-sm single-text">
															{{item.simple_desc}}
														</view>
													</view>
													<view class="margin-top-sm oh">
														<view class="sales-price text-size-sm single-text pa">
															{{currency_symbol}}{{item.min_price}}
														</view>
														<view class="buy-opt tc pa">
															<block v-if="(item.inventory || 0) > 0">
																<view v-if="(item.buy_number || 0) > 0"
																	class="dis-inline-block va-m cp" :data-index="index"
																	data-type="0" @tap.stop="buy_number_event">
																	<uni-icons type="minus" size="22"
																		color="#f00"></uni-icons>
																</view>
																<view v-if="(item.buy_number || 0) > 0"
																	class="buy-number dis-inline-block cr-base text-size-sm padding-left-xs padding-right-xs va-m">
																	{{item.buy_number}}
																</view>
																<view class="dis-inline-block va-m cp"
																	:data-index="index" data-type="1"
																	@tap.stop="buy_number_event">
																	<uni-icons type="plus" size="22"
																		color="#1AAD19"></uni-icons>
																</view>
															</block>
															<block v-else>
																<text class="cr-grey text-size-xs">{{$t('goodscategory.Out-of-stock')}}</text>
															</block>
														</view>
													</view>
												</view>
											</view>
										</view>
									</view>
									<block v-else>
										<component-no-data :propStatus="data_list_loding_status"
											:propMsg="data_list_loding_msg"></component-no-data>
									</block>
								</view>
							</scroll-view>
						</view>
					</block>
					<block v-else>
						<!-- 一级导航 -->
						<view class="left-nav bg-white ht-auto">
							<scroll-view :scroll-y="true" class="ht-auto">
								<block v-for="(item, index) in category_list" :key="index">
									<view
										:class="'text-size-sm item tc cr-base cp oh ' + (nav_active_index == index ? 'nav-active cr-main border-color-main' : '')"
										:data-index="index" :data-itemindex="-1" @tap="nav_event">
										<text>{{item.name}}</text>
									</view>
								</block>
							</scroll-view>
						</view>
						<view class="right-container pa">
							<scroll-view :scroll-y="true" class="ht-auto">
								<!-- 一级内容基础容 -->
								<view v-if="(data_content || null) != null"
									class="padding-top-main padding-horizontal-main oh">
									<!-- 一级基础信息 -->
									<view
										v-if="(data_content.vice_name || null) != null || (data_content.describe || null) != null"
										class="one-content bg-white padding-main border-radius-main cp spacing-mb"
										:data-value="data_content.id" @tap="category_event">
										<view v-if="(data_content.vice_name || null) != null" class="text-size fw-b"
											:style="'color:' + data_content.bg_color + ';'">{{data_content.vice_name}}
										</view>
										<view v-if="(data_content.describe || null) != null"
											class="cr-grey margin-top-sm">{{data_content.describe}}</view>
									</view>
									<!-- 一二级数据渲染 -->
									<block v-if="(data_content.items || null) != null && data_content.items.length > 0">
										<!-- 二级模式 -->
										<block v-if="category_show_level == 2">
											<view
												class="two-content bg-white oh padding-main border-radius-main spacing-mb">
												<block v-for="(v, index) in data_content.items" :key="index">
													<view class="content-item padding-sm tc cp" :data-value="v.id"
														@tap="category_event">
														<view class="content wh-auto">
															<image v-if="(v.icon || null) != null" :src="v.icon"
																mode="aspectFit" class="icon radius"></image>
															<view class="text single-text">{{v.name}}</view>
														</view>
													</view>
												</block>
											</view>
										</block>
										<!-- 三级模式 -->
										<block v-if="category_show_level == 3">
											<block v-for="(v, index) in data_content.items" :key="index">
												<view class="spacing-nav-title">
													<text class="text-wrapper text-size-md">{{v.name}}</text>
													<text v-if="(v.describe || null) != null"
														class="vice-name margin-left-lg cr-gray">{{v.describe}}</text>
													<view :data-value="v.id" @tap="category_event"
														class="arrow-right padding-right-xxxl cr-gray fr cp">{{$t('index.more')}}</view>
												</view>
												<view v-if="(v.items || null) != null && v.items.length > 0"
													class="bg-white oh padding-main border-radius-main spacing-mb">
													<block v-for="(vs, index2) in v.items" :key="index2">
														<view class="content-item padding-sm tc cp" :data-value="vs.id"
															@tap="category_event">
															<view class="content wh-auto">
																<image v-if="(vs.icon || null) != null" :src="vs.icon"
																	mode="aspectFit" class="icon radius"></image>
																<view class="text single-text">{{vs.name}}</view>
															</view>
														</view>
													</block>
												</view>
											</block>
										</block>
									</block>
									<block v-else>
										<!-- 提示信息 -->
										<component-no-data propStatus="0" :propMsg="nocategory"></component-no-data>
									</block>
								</view>
								<view v-else>
									<!-- 提示信息 -->
									<component-no-data propStatus="0" :propMsg="nocategory"></component-no-data>
								</view>
							</scroll-view>
						</view>
					</block>
				</block>
			</view>

			<view v-if="category_list.length == 0 && data_list_loding_status != 0">
				<!-- 提示信息 -->
				<component-no-data :propStatus="data_list_loding_status"></component-no-data>
			</view>

			<!-- 仅商品模式展示购物车和规格选择 -->
			<block v-if="category_show_level == 0">
				<!-- 购物车列表 -->
				<block v-if="cart_status">
					<view class="cart-mask wh-auto ht-auto pf" @tap="cart_event"></view>
					<view class="cart-content bg-white border-radius-main pa oh">
						<block v-if="(cart || null) != null && (cart.data || null) != null && cart.data.length > 0">
							<view class="oh br-b padding-vertical-main padding-horizontal-main">
								<text class="va-m text-size-xs cr-base">{{$t('goodscategory.Selected-product')}}</text>
								<view class="fr cp" @tap="cart_all_delete_event">
									<view class="dis-inline-block va-m">
										<uni-icons type="trash" size="12" color="#f00"></uni-icons>
									</view>
									<text class="cr-red va-m text-size-xs margin-left-xs">{{$t('goodscategory.empty')}}</text>
								</view>
							</view>
							<scroll-view :scroll-y="true" class="cart-list goods-list">
								<view v-for="(goods, index) in cart.data" :key="index"
									class="item padding-main oh spacing-mb">
									<navigator :url="goods.goods_url" hover-class="none">
										<image :src="goods.images" mode="widthFix" class="goods-img radius fl br">
										</image>
										<view class="goods-base fr">
											<view class="goods-base-content">
												<view class="goods-title text-size-sm single-text">{{goods.title}}
												</view>
												<view v-if="goods.spec != null"
													class="text-size-xs cr-grey margin-top-sm">
													<block v-for="(sv, si) in goods.spec" :key="si">
														<text v-if="si > 0"
															class="padding-left-xs padding-right-xs">;</text>
														<text>{{sv.value}}</text>
													</block>
												</view>
											</view>
											<view class="margin-top-sm oh">
												<view
													class="sales-price text-size-sm single-text dis-inline-block va-m">
													{{currency_symbol}}{{goods.price}}
												</view>
												<view class="tc fr">
													<block v-if="goods.is_error == 0">
														<view v-if="(goods.stock || 0) > 0"
															class="dis-inline-block va-m cp" :data-index="index"
															data-type="0" @tap.stop="cart_buy_number_event">
															<uni-icons type="minus" size="22" color="#f00"></uni-icons>
														</view>
														<view v-if="(goods.stock || 0) > 0"
															class="buy-number dis-inline-block cr-base text-size-sm padding-left-xs padding-right-xs va-m">
															{{goods.stock}}
														</view>
														<view class="dis-inline-block va-m cp" :data-index="index"
															data-type="1" @tap.stop="cart_buy_number_event">
															<uni-icons type="plus" size="22"
																color="#1AAD19"></uni-icons>
														</view>
													</block>
													<block v-else>
														<text class="cr-red">{{goods.error_msg}}</text>
													</block>
												</view>
											</view>
										</view>
									</navigator>
								</view>
							</scroll-view>
						</block>
						<block v-else>
							<component-no-data propStatus="0" :propMsg="Please_select_product"></component-no-data>
						</block>
					</view>
				</block>
				<!-- 购物车底部导航 -->
				<view class="botton-nav rounds pa bg-main-pairs oh">
					<view class="cart dis-inline-block va-m margin-left-xxl pr cp" @tap="cart_event">
						<!-- <uni-icons type="cart" size="18" color="#fff"></uni-icons> -->
						
						<!-- #ifdef H5 -->
						<svg xmlns="http://www.w3.org/2000/svg" width="20.082" height="19.183" viewBox="0 0 20.082 19.183">
						  <path id="路径_7" data-name="路径 7" d="M124.716,517.131a2.139,2.139,0,0,1-.869-.181,2.253,2.253,0,0,1-1.173-1.173,2.163,2.163,0,0,1,0-1.733,2.293,2.293,0,0,1,.475-.7,2.13,2.13,0,0,1,.544-.394h-6.012a2.086,2.086,0,0,1,.471.355,2.289,2.289,0,0,1,.475.7,2.167,2.167,0,0,1,0,1.733,2.243,2.243,0,0,1-1.173,1.174,2.232,2.232,0,0,1-1.752,0,2.3,2.3,0,0,1-.7-.475,2.273,2.273,0,0,1-.475-.7,2.17,2.17,0,0,1,0-1.732,2.284,2.284,0,0,1,.475-.7,2.107,2.107,0,0,1,.542-.393,1.413,1.413,0,0,1-.5-.206,1.873,1.873,0,0,1-.559-.581,3.247,3.247,0,0,1-.325-.7,6.131,6.131,0,0,1-.178-.67c-.015-.09-.05-.274-.108-.569s-.13-.674-.215-1.125l-.6-3.176q-.345-1.838-.776-4.065h-1.132a1.184,1.184,0,0,1-.731-.228,1.667,1.667,0,0,1-.423-.462,1.764,1.764,0,0,1-.228-.569,2.544,2.544,0,0,1-.057-.513,1.271,1.271,0,0,1,.387-.936,1.379,1.379,0,0,1,.994-.366h1.973a1.781,1.781,0,0,1,.806.159,1.477,1.477,0,0,1,.509.406,1.557,1.557,0,0,1,.264.5l.1.338a4.58,4.58,0,0,1,.09.494l.078.578c.021.124.042.256.064.392h4.062a.5.5,0,0,1-.034-.066.4.4,0,0,1,.087-.441l2.578-2.58a1.8,1.8,0,0,1,1.266-.577,1.825,1.825,0,0,1,1.279.558l2.6,2.6a.4.4,0,0,1,.087.441.4.4,0,0,1-.035.066H128a2.362,2.362,0,0,1,1.026.187,1.371,1.371,0,0,1,.6.521,1.229,1.229,0,0,1,.173.679,1.97,1.97,0,0,1-.089.532,38.093,38.093,0,0,1-2.252,4.34,1.877,1.877,0,0,1-1.2.391h-9.8l.184,1.658h9.5c1.211,0,1.342.843,1.342,1.2a3.626,3.626,0,0,1-.252,1.36,1.187,1.187,0,0,1-1.07.466h-.412a2.115,2.115,0,0,1,.551.394,2.294,2.294,0,0,1,.475.7,2.165,2.165,0,0,1,0,1.734,2.229,2.229,0,0,1-1.261,1.2,2.149,2.149,0,0,1-.574.139C124.864,517.128,124.79,517.131,124.716,517.131Zm0-3.615a1.422,1.422,0,0,0-.551.107,1.359,1.359,0,0,0-.443.293,1.517,1.517,0,0,0-.307.454,1.361,1.361,0,0,0,0,1.081,1.493,1.493,0,0,0,.306.452,1.456,1.456,0,0,0,.453.307,1.378,1.378,0,0,0,1.044.02,1.47,1.47,0,0,0,.509-.327,1.452,1.452,0,0,0,.307-.453,1.354,1.354,0,0,0,0-1.08,1.477,1.477,0,0,0-.306-.454,1.322,1.322,0,0,0-.451-.292A1.512,1.512,0,0,0,124.714,513.516Zm-8.127-.039a1.463,1.463,0,0,0-.568.106,1.305,1.305,0,0,0-.445.294,1.473,1.473,0,0,0-.307.454,1.361,1.361,0,0,0,0,1.08,1.44,1.44,0,0,0,.761.762,1.4,1.4,0,0,0,1.1,0,1.442,1.442,0,0,0,.759-.76,1.363,1.363,0,0,0,0-1.08,1.485,1.485,0,0,0-.306-.454,1.32,1.32,0,0,0-.444-.293A1.41,1.41,0,0,0,116.587,513.478Zm-5.49-13.929a.594.594,0,0,0-.433.141.452.452,0,0,0-.14.353,1.74,1.74,0,0,0,.04.348.932.932,0,0,0,.124.31.882.882,0,0,0,.222.241.4.4,0,0,0,.245.065h1.465a.405.405,0,0,1,.4.328q.469,2.425.84,4.4l.6,3.175q.127.672.215,1.12c.059.307.1.5.109.579a5.283,5.283,0,0,0,.151.567,2.392,2.392,0,0,0,.243.527,1.056,1.056,0,0,0,.319.335.767.767,0,0,0,.43.108H126.16c.242,0,.362-.052.394-.1a3.7,3.7,0,0,0,.12-.917c0-.185,0-.4-.533-.4h-9.867a.4.4,0,0,1-.4-.36L115.6,507.9a.4.4,0,0,1,.4-.449h10.256a1.071,1.071,0,0,0,.7-.215c.238-.291,1.871-3.678,1.994-3.979a1.194,1.194,0,0,0,.043-.293.421.421,0,0,0-.061-.236.6.6,0,0,0-.258-.2,1.585,1.585,0,0,0-.674-.106H114.633a.4.4,0,0,1-.4-.344c-.04-.259-.078-.5-.117-.737l-.079-.588a3.941,3.941,0,0,0-.07-.4l-.092-.315a.743.743,0,0,0-.128-.239.671.671,0,0,0-.233-.179,1,1,0,0,0-.444-.074Zm9.26,1.437h5.2l-1.908-1.908a.956.956,0,0,0-.694-.321,1.018,1.018,0,0,0-.708.34Z" transform="translate(-109.716 -497.948)" fill="#ef5b55"/>
						</svg>
						<!-- #endif -->
						<!-- #ifdef APP -->
						<image src="../../static/images/common/category-cart.png" mode="" class="category-cart"></image>
						<!-- #endif -->
						<view v-if="(cart || null) != null && (cart.buy_number || 0) > 0" class="badge-icon pa">
							<component-badge :propNumber="cart.buy_number"></component-badge>
						</view>
					</view>
					<view class="cart-total-price single-text dis-inline-block fw-b cr-whites va-m margin-left-xl">
						<text class="text-size-sm">{{currency_symbol}}</text>
						<text class="text-size-lg">{{(cart || null) == null ? 0 : (cart.total_price || 0)}}</text>
					</view>
					<button type="default" size="mini" hover-class="none" @tap="buy_submit_event"
						class="text-size-sm pa radius-0 bg-main cr-white">{{$t('goodscategory.account')}}</button>
				</view>

				<!-- 规格选择弹层 -->
				<component-popup :propShow="popup_spec_status" propPosition="bottom" @onclose="popup_spec_close_event">
					<view class="goods-spec-popup padding-main bg-white pr">
						<view class="close fr oh">
							<view class="fr" @tap.stop="popup_spec_close_event">
								<icon type="clear" size="20"></icon>
							</view>
						</view>
						<!-- 规格基础信息 -->
						<view class="goods-spec-popup-base oh br-b pr">
							<image :src="goods_spec_base_images" mode="scaleToFill" class="radius br"
								@tap="goods_spec_base_images_view_event" :data-value="goods_spec_base_images"></image>
							<view class="goods-spec-popup-base-content">
								<view class="goods-price">
									<view class="sales-price">{{currency_symbol}}{{goods_spec_base_price}}</view>
									<view
										v-if="(goods_spec_base_original_price || null) != null && goods_spec_base_original_price != 0"
										class="original-price">{{currency_symbol}}{{goods_spec_base_original_price}}
									</view>
								</view>
								<view class="inventory">
									<text class="cr-gray">{{$t('goodscategory.inventory')}}</text>
									<text class="cr-base">{{goods_spec_base_inventory}}</text>
									<text class="cr-gray">{{goods_choose_data.inventory_unit}}</text>
								</view>
							</view>
						</view>
						<!-- 商品规格 -->
						<view class="goods-spec-popup-content">
							<view v-if="goods_specifications_choose.length > 0" class="goods-spec-choose">
								<view v-for="(item, key) in goods_specifications_choose" :key="key" class="item br-b">
									<view class="text-size">{{item.name}}</view>
									<view v-if="item.value.length > 0" class="spec margin-top-sm">
										<block v-for="(items, keys) in item.value" :key="keys">
											<button @tap.stop="goods_specifications_event" :data-key="key"
												:data-keys="keys" type="default" size="mini" hover-class="none"
												:class="items.is_active + ' ' + items.is_dont + ' ' + items.is_disabled">
												<image v-if="(items.images || null) != null" :src="items.images"
													mode="scaleToFill"
													class="va-m dis-inline-block round margin-right-sm"></image>
												<text class="va-m">{{items.name}}</text>
											</button>
										</block>
									</view>
								</view>
							</view>
						</view>
						<button class="goods-spec-popup-submit bg-main cr-white" type="default"
							@tap.stop="goods_spec_confirm_event" hover-class="none">{{$t('goodscategory.affirm')}}</button>
					</view>
				</component-popup>
			</block>

			<!-- 快捷导航 -->
			<!-- <component-quick-nav :propIsNav="true" :propIsBar="true"></component-quick-nav> -->
		</view>
	</view>
</template>

<script>
	const app = getApp();
	import componentSearch from "../../components/search/search";
	import componentQuickNav from "../../components/quick-nav/quick-nav";
	import componentNoData from "../../components/no-data/no-data";
	import componentPopup from "../../components/popup/popup";
	import componentBadge from "../../components/badge/badge";

	var common_static_url = app.globalData.get_static_url('common');
	// 状态栏高度
	var bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0));
	// #ifdef MP-TOUTIAO
	bar_height = 0;
	// #endif

	export default {
		data() {
			return {
				common_static_url: common_static_url,
				status_bar_height: bar_height,
				data_bottom_line_status: false,
				data_list_loding_status: 1,
				data_list_loding_msg: '',
				category_list: [],
				data_content: null,
				data_three_content: null,
				Please_select_product:this.$t('goodscategory.Please-select-product'),
				nocategory:this.$t('goodscategory.nocategory'),
				searchtitle:this.$t('index.searchtitle'),
				cart: null,
				data_list: [],
				data_total: 0,
				data_page_total: 0,
				data_page: 1,
				currency_symbol: app.globalData.data.currency_symbol,
				is_first: 1,
				search_keywords_value: '',
				nav_active_index: 0,
				nav_active_item_two_index: -1,
				nav_active_item_three_index: -1,
				scroll_top: 0,
				scroll_top_old: 0,
				cart_status: false,
				popup_spec_status: false,
				goods_spec_base_price: 0,
				goods_spec_base_original_price: 0,
				goods_spec_base_inventory: 0,
				goods_spec_base_images: '',
				goods_choose_data: {},
				goods_specifications_choose: [],
				// 基础配置
				category_show_level: 0,
				// 自定义分享信息
				share_info: {},
				// 是否单页预览
				is_single_page: app.globalData.is_current_single_page() || 0,
				// 商品列表模式一级分类图标类型
				category_goods_model_icon_field: app.globalData.data.category_goods_model_icon_type == 0 ? 'big_images' :
					'icon'
			};
		},

		components: {
			componentSearch,
			componentQuickNav,
			componentNoData,
			componentPopup,
			componentBadge
		},
		props: {},

		onShow() {
			// 数据加载
			this.init();

			// 初始化配置
			this.init_config();
		},

		// 下拉刷新
		onPullDownRefresh() {
			this.init();
		},

		methods: {
			// 初始化配置
			init_config(status) {
				if ((status || false) == true) {
					this.setData({
						currency_symbol: app.globalData.get_config('currency_symbol'),
						category_show_level: app.globalData.get_config('config.category_show_level')
					});
				} else {
					app.globalData.is_config(this, 'init_config');
				}
			},

			// 获取数据
			init() {
				if (this.is_first == 1) {
					this.setData({
						data_list_loding_status: 1
					});
				}

				uni.request({
					url: app.globalData.get_request_url("category", "goods"),
					method: 'POST',
					data: {},
					dataType: 'json',
					success: res => {
						uni.stopPullDownRefresh();
						if (res.data.code == 0) {
							var temp_category = res.data.data.category || [];
							var upd_data = {
								category_list: temp_category,
								data_content: temp_category[this.nav_active_index] || null
							}
							// 非商品列表模式
							if (this.category_show_level != 0) {
								upd_data['data_list_loding_status'] = temp_category.length == 0 ? 0 : 3;
								upd_data['data_bottom_line_status'] = true;
							}
							this.setData(upd_data);

							// 商品列表模式
							if (this.category_show_level == 0) {
								// 商品列表模式获取购物车数据
								this.get_cart_data();
								// 获取商品列表、仅首次请求商品列表
								if (this.is_first == 1) {
									this.get_goods_list(1);
								}
							} else {
								// 分类模式下、仅首次请求购物车接口和商品模式下
								if (this.is_first == 1 && this.category_show_level == 0) {
									this.get_cart_data();
								}
							}
							// 是否首次记录
							this.setData({
								is_first: 0
							});
						} else {
							this.setData({
								data_list_loding_status: 2,
								data_list_loding_msg: res.data.msg
							});
						}

						// 基础自定义分享
						this.setData({
							share_info: {
								path: '/pages/goods-category/goods-category'
							}
						});

						// 分享菜单处理、延时执行，确保基础数据已加载完成
						setTimeout(function() {
							app.globalData.page_share_handle(this.share_info);
						}, 3000);
					},
					fail: () => {
						uni.stopPullDownRefresh();
						this.setData({
							data_list_loding_status: 2,
							data_list_loding_msg: this.$t('globalData.Server-request-error')
						});
						app.globalData.showToast(this.$t('globalData.Server-request-error'));
					}
				});
			},

			// 获取商品列表
			get_goods_list(is_mandatory) {
				// 分页是否还有数据
				if ((is_mandatory || 0) == 0) {
					if (this.data_bottom_line_status == true) {
						uni.stopPullDownRefresh();
						return false;
					}
				}

				// 请求参数
				var data = {
					page: this.data_page,
					wd: this.search_keywords_value || ''
				};
				// 分类id
				if ((this.data_content || null) != null) {
					// 主分类id
					data['category_id'] = this.data_content['id'];
					// 是否选中了二级分类
					if (this.nav_active_item_two_index != -1) {
						data['category_id'] = this.data_content['items'][this.nav_active_item_two_index]['id'];
					}
					// 是否选中了三级分类
					if (this.data_three_content != null && this.nav_active_item_three_index != -1) {
						data['category_id'] = this.data_three_content['items'][this.nav_active_item_three_index]['id'];
					}
				}

				// 获取数据
				uni.request({
					url: app.globalData.get_request_url("datalist", "search"),
					method: 'POST',
					data: data,
					dataType: 'json',
					success: res => {
						if (res.data.code == 0) {
							var data = res.data.data;
							if (data.data.length > 0) {
								if (this.data_page <= 1) {
									var temp_data_list = data.data;
								} else {
									var temp_data_list = this.data_list || [];
									var temp_data = data.data;
									for (var i in temp_data) {
										temp_data_list.push(temp_data[i]);
									}
								}
								this.setData({
									data_list: temp_data_list,
									data_total: data.total,
									data_page_total: data.page_total,
									data_list_loding_status: 3,
									data_page: this.data_page + 1
								});

								// 是否还有数据
								this.setData({
									data_bottom_line_status: (this.data_page > 1 && this.data_page >
										this.data_page_total)
								});

								// 购物车数据处理
								this.cart_data_list_handle();
							} else {
								this.setData({
									data_list_loding_status: 0,
									data_total: 0
								});
								if (this.data_page <= 1) {
									this.setData({
										data_list: [],
										data_bottom_line_status: false
									});
								}
							}
						} else {
							this.setData({
								data_list_loding_status: 0,
								data_list_loding_msg: res.data.msg
							});
							app.globalData.showToast(res.data.msg);
						}
					},
					fail: () => {
						this.setData({
							data_list_loding_status: 2,
							data_list_loding_msg: this.$t('globalData.Server-request-error')
						});
						app.globalData.showToast(this.$t('globalData.Server-request-error'));
					}
				});
			},

			// 重置滑动位置
			reset_scroll() {
				this.setData({
					scroll_top: this.scroll_top_old
				});
				this.$nextTick(() => {
					this.setData({
						scroll_top: 0
					});
				});
			},

			// 滑动事件位置记录
			scroll_event(e) {
				this.setData({
					scroll_top_old: e.detail.scrollTop
				});
			},

			// 滚动加载
			scroll_lower(e) {
				this.get_goods_list();
			},

			// 导航事件
			nav_event(e) {
				var index = e.currentTarget.dataset.index; //下标
				var two_index = e.currentTarget.dataset.itemtwoindex; //一级传-1，二级传的当前下标
				var three_index = e.currentTarget.dataset.itemthreeindex; //-1
				var temp_data_content = this.category_list[index] || null; //对应标的当前数据
				var temp_data_three_content = null;
				if (two_index != -1 && temp_data_content != null) {//不为空说明是二级
					temp_data_three_content = temp_data_content['items'][two_index];//二级内部的数组赋值三级
				}
				this.setData({
					nav_active_index: index,
					nav_active_item_two_index: two_index,
					nav_active_item_three_index: three_index,
					data_content: temp_data_content,
					data_three_content: temp_data_three_content,
					data_page: 1,
					data_list_loding_status: 1,
					data_list: []
				});

				// 商品模式则读取商品
				if (this.category_show_level == 0) {
					this.reset_scroll();
					this.get_goods_list(1);
				}
			},

			// 分类事件
			category_event(e) {
				uni.navigateTo({
					url: '/pages/goods-search/goods-search?category_id=' + e.currentTarget.dataset.value
				});
			},

			// 搜索事件
			search_button_event(e) {
				// 商品列表模式
				if (this.category_show_level == 0) {
					this.setData({
						search_keywords_value: e || '',
						data_page: 1,
						data_list_loding_status: 1,
						data_list: []
					});
					this.get_goods_list(1);
				} else {
					// 进入搜索页面
					uni.navigateTo({
						url: '/pages/goods-search/goods-search' + (((e || null) == null) ? '' : '?keywords=' + e)
					});
				}
			},

			// url事件
			url_event(e) {
				app.globalData.url_event(e);
			},

			// 列表数据操作
			buy_number_event(e) {
				if (!app.globalData.is_single_page_check()) {
					return false;
				}
				var user = app.globalData.get_user_info(this);
				if (user != false) {
					// 用户未绑定用户则转到登录页面
					if (app.globalData.user_is_need_login(user)) {
						uni.navigateTo({
							url: "/pages/login/login?event_callback=buy_number_event"
						});
						return false;
					} else {
						var index = e.currentTarget.dataset.index;
						var type = parseInt(e.currentTarget.dataset.type) || 0;
						var temp_goods = this.data_list[index];

						// 是否存在多规格
						if ((temp_goods.is_exist_many_spec || 0) != 0) {
							// 是否购物车中操作
							if (type == 0) {
								this.setData({
									cart_status: true
								});
								app.globalData.showToast(this.$t('goodscategory.Different-specifications'));
							} else {
								// 展示规格选择
								var temp_specifications = temp_goods['specifications']['choose'] || [];
								if (temp_specifications.length > 0) {
									for (var i in temp_specifications) {
										for (var k in temp_specifications[i]['value']) {
											temp_specifications[i]['value'][k]['is_active'] = '';
											if (i > 0) {
												temp_specifications[i]['value'][k]['is_dont'] = 'spec-dont-choose';
											}
										}
									}
								}
								this.setData({
									popup_spec_status: true,
									goods_choose_data: temp_goods,
									goods_specifications_choose: temp_specifications,
									goods_spec_base_price: temp_goods.price,
									goods_spec_base_original_price: temp_goods.original_price || 0,
									goods_spec_base_inventory: temp_goods.inventory,
									goods_spec_base_images: temp_goods.images,
								});
							}
							return false;
						}

						// 数据操作处理
						this.buy_number_event_handle(type, temp_goods);
					}
				}
			},

			// 列表数量事件处理
			buy_number_event_handle(type, goods, spec = '') {
				var res = this.buy_number_handle(type, goods, 'buy_number');
				if (res === false) {
					return false;
				}

				// 为0或减操作则查询
				var cart_item = null;
				if (type == 0 || (type == 1 && goods['buy_number'] > 0)) {
					var cart_data = this.cart.data;
					var params_spec = ((spec || null) == null || typeof(spec) != 'object') ? '' : JSON.stringify(spec);
					for (var i in cart_data) {
						if (goods['id'] == cart_data[i]['goods_id']) {
							var cart_spec = ((cart_data[i]['spec'] || null) == null || typeof(cart_data[i]['spec']) !=
								'object') ? '' : JSON.stringify(cart_data[i]['spec']);
							if (type == 0 || (type == 1 && cart_spec == params_spec)) {
								cart_item = cart_data[i];
							}
							break;
						}
					}
				}

				// 操作类型
				if (res == 0) {
					if (cart_item == null) {
						app.globalData.showToast(this.$t('goodscategory.id-cart'));
						return false;
					}
					this.cart_delete(cart_item.id);
				} else if (cart_item == null) {
					this.cart_save(goods['id'], res, spec);
				} else {
					var number = (type == 0) ? parseInt(cart_item['stock']) - res : res + parseInt(cart_item['stock']);
					this.cart_update(cart_item.id, goods['id'], number);
				}
				return true;
			},

			// 购物车数量操作
			cart_buy_number_event(e) {
				if (!app.globalData.is_single_page_check()) {
					return false;
				}
				var user = app.globalData.get_user_info(this);
				if (user != false) {
					// 用户未绑定用户则转到登录页面
					if (app.globalData.user_is_need_login(user)) {
						uni.navigateTo({
							url: "/pages/login/login?event_callback=cart_buy_number_event"
						});
						return false;
					} else {
						var index = e.currentTarget.dataset.index;
						var type = parseInt(e.currentTarget.dataset.type) || 0;
						var temp_data = this.cart.data;
						var temp_goods = temp_data[index];

						// 数据操作处理
						var res = this.buy_number_handle(type, temp_goods, 'stock');
						if (res === false) {
							return false;
						}

						// 操作类型
						if (res == 0) {
							this.cart_delete(temp_goods['id']);
						} else {
							var number = (type == 0) ? parseInt(temp_goods['stock']) - res : res + parseInt(temp_goods[
								'stock']);
							this.cart_update(temp_goods['id'], temp_goods['goods_id'], number);
						}
					}
				}
			},

			// 数量操作处理
			buy_number_handle(type, goods, buy_number_field) {
				// 加减处理
				var buy_number = parseInt(goods[buy_number_field]) || 0;
				if (type == 0) {
					buy_number -= 1;
				} else {
					buy_number += 1;
				}
				if (buy_number < 0) {
					buy_number = 0;
				}

				// 数据校验
				var buy_min_number = parseInt(goods['buy_min_number']) || 1;
				var buy_max_number = parseInt(goods['buy_max_number']) || 0;
				var inventory = parseInt(goods['inventory']);
				var inventory_unit = goods['inventory_unit'];
				if (buy_min_number > 0) {
					if (type == 0) {
						if (buy_number < buy_min_number) {
							buy_number = 0;
						}
					} else {
						if (buy_number < buy_min_number) {
							buy_number = buy_min_number;
						}
					}
				}
				if (buy_max_number > 0 && buy_number > buy_max_number) {
					app.globalData.showToast(this.$t('goodsdetail.purchase-restrictions') + buy_max_number + inventory_unit);
					return false;
				}
				if (buy_number > inventory) {
					app.globalData.showToast(this.$t('goodsdetail.Inventory-quantity') + inventory + inventory_unit);
					return false;
				}
				if (goods[buy_number_field] == buy_number) {
					app.globalData.showToast(this.$t('goodscategory.sum-change'));
					return false;
				}

				// 操作数量
				var opt_number = 1;
				if (type == 0) {
					if (buy_number <= 0) {
						opt_number = 0;
					}
				} else {
					if (buy_number > goods['buy_number']) {
						opt_number = buy_number - goods['buy_number'];
					}
				}
				return opt_number;
			},

			// 购物车添加
			cart_save(goods_id, buy_number, spec = '') {
				uni.showLoading({
					title: this.$t('globalData.Processing')
				});
				uni.request({
					url: app.globalData.get_request_url('save', 'cart'),
					method: 'POST',
					data: {
						"goods_id": goods_id,
						"stock": buy_number,
						"spec": spec
					},
					dataType: 'json',
					success: res => {
						uni.hideLoading();
						if (res.data.code == 0) {
							this.get_cart_data();
						} else {
							if (app.globalData.is_login_check(res.data)) {
								app.globalData.showToast(res.data.msg);
							}
						}
					},
					fail: () => {
						uni.hideLoading();
						app.globalData.showToast(this.$t('globalData.Server-request-error'));
					}
				});
			},

			// 购物车更新
			cart_update(cart_id, goods_id, buy_number) {
				uni.showLoading({
					title: this.$t('globalData.Processing'),
					mask: true
				});
				uni.request({
					url: app.globalData.get_request_url("stock", "cart"),
					method: 'POST',
					data: {
						"id": cart_id,
						"goods_id": goods_id,
						"stock": buy_number
					},
					dataType: 'json',
					success: res => {
						uni.hideLoading();
						if (res.data.code == 0) {
							this.get_cart_data();
						} else {
							if (app.globalData.is_login_check(res.data)) {
								app.globalData.showToast(res.data.msg);
							} else {
								app.globalData.showToast(this.$t('globalData.Submission-failed'));
							}
						}
					},
					fail: () => {
						uni.hideLoading();
						app.globalData.showToast(this.$t('globalData.Server-request-error'));
					}
				});
			},

			// 购物车删除
			cart_delete(cart_id) {
				uni.showLoading({
					title: this.$t('globalData.Processing'),
					mask: true
				});
				uni.request({
					url: app.globalData.get_request_url('delete', 'cart'),
					method: 'POST',
					data: {
						"id": cart_id
					},
					dataType: 'json',
					success: res => {
						uni.hideLoading();
						if (res.data.code == 0) {
							this.get_cart_data();
						} else {
							if (app.globalData.is_login_check(res.data)) {
								app.globalData.showToast(res.data.msg);
							} else {
								app.globalData.showToast(this.$t('globalData.Submission-failed'));
							}
						}
					},
					fail: () => {
						uni.hideLoading();
						app.globalData.showToast(this.$t('globalData.Server-request-error'));
					}
				});
			},

			// 获取购物车数据
			get_cart_data() {
				uni.request({
					url: app.globalData.get_request_url("index", "cart"),
					method: 'POST',
					data: {},
					dataType: 'json',
					success: res => {
						if (res.data.code == 0) {
							var data = res.data.data;
							var temp_cart = data.data || [];
							this.setData({
								cart: res.data.data
							});
							this.cart_data_list_handle();

							// 导航购物车处理
							if (data.buy_number <= 0) {
								app.globalData.set_tab_bar_badge(2, 0);
							} else {
								app.globalData.set_tab_bar_badge(2, 1, data.buy_number);
							}
						}
					},
					fail: () => {
						app.globalData.showToast(this.$t('globalData.Server-request-error'));
					}
				});
			},

			// 购物车更新列表数据处理
			cart_data_list_handle() {
				var temp_cart = this.cart || null;
				if (temp_cart != null) {
					var temp_data_list = this.data_list;
					if (temp_data_list.length > 0) {
						for (var i in temp_data_list) {
							temp_data_list[i]['buy_number'] = 0;
							if (temp_cart.data.length > 0) {
								for (var k in temp_cart.data) {
									if (temp_cart.data[k]['goods_id'] == temp_data_list[i]['id']) {
										temp_data_list[i]['buy_number'] += parseInt(temp_cart.data[k]['stock']);
									}
								}
							}
						}
					}
					this.setData({
						data_list: temp_data_list
					});
				}
			},

			// 规格选择弹层关闭
			popup_spec_close_event(e) {
				this.setData({
					popup_spec_status: false
				});
			},

			// 规格事件
			goods_specifications_event(e) {
				var key = e.currentTarget.dataset.key || 0;
				var keys = e.currentTarget.dataset.keys || 0;
				this.goods_specifications_handle(key, keys);
			},

			// 规格选择处理
			goods_specifications_handle(key, keys) {
				// 不能选择和禁止选择跳过
				var temp_data = this.goods_specifications_choose;
				var temp_images = this.goods_spec_base_images;
				if ((temp_data[key]['value'][keys]['is_dont'] || null) == null && (temp_data[key]['value'][keys][
						'is_disabled'
					] || null) == null) {
					// 规格选择
					for (var i in temp_data) {
						for (var k in temp_data[i]['value']) {
							if ((temp_data[i]['value'][k]['is_dont'] || null) == null && (temp_data[i]['value'][k][
									'is_disabled'
								] || null) == null) {
								if (key == i) {
									if (keys == k && (temp_data[i]['value'][k]['is_active'] || null) == null) {
										temp_data[i]['value'][k]['is_active'] = 'cr-white bg-main br-main';
										if ((temp_data[i]['value'][k]['images'] || null) != null) {
											temp_images = temp_data[i]['value'][k]['images'];
										}
									} else {
										temp_data[i]['value'][k]['is_active'] = '';
									}
								}
							}
						}
					}
					this.setData({
						goods_specifications_choose: temp_data,
						goods_spec_base_images: temp_images
					});

					// 不能选择规格处理
					this.goods_specifications_choose_handle_dont(key);

					// 获取下一个规格类型
					this.get_goods_specifications_type(key);

					// 获取规格详情
					this.get_goods_specifications_detail();
				}

				// 已选择规格
				var spec_selected = [];
				for (var i in temp_data) {
					for (var k in temp_data[i]['value']) {
						if ((temp_data[i]['value'][k]['is_active'] || null) != null) {
							spec_selected.push(temp_data[i]['value'][k]['name']);
						}
					}
				}
				this.setData({
					goods_spec_selected_text: (spec_selected.length <= 0) ? this.$t('goodsdetail.Select-specifications') : spec_selected.join(' / ')
				});
			},

			// 不能选择规格处理
			goods_specifications_choose_handle_dont(key) {
				var temp_data = this.goods_specifications_choose || [];
				if (temp_data.length <= 0) {
					return false;
				}

				// 是否不能选择
				key = parseInt(key);
				for (var i in temp_data) {
					for (var k in temp_data[i]['value']) {
						if (i > key) {
							temp_data[i]['value'][k]['is_dont'] = 'spec-dont-choose';
							temp_data[i]['value'][k]['is_disabled'] = '';
							temp_data[i]['value'][k]['is_active'] = '';
						}

						// 当只有一个规格的时候
						if (key == 0 && temp_data.length == 1) {
							temp_data[i]['value'][k]['is_disabled'] = (temp_data[i]['value'][k]['is_only_level_one'] ||
									null) != null && (temp_data[i]['value'][k]['inventory'] || 0) <= 0 ?
								'spec-items-disabled' : '';
						}
					}
				}

				this.setData({
					goods_specifications_choose: temp_data
				});
			},

			// 获取下一个规格类型
			get_goods_specifications_type(key) {
				var temp_data = this.goods_specifications_choose;
				var active_index = parseInt(key) + 1;
				var sku_count = app.globalData.get_length(temp_data);
				if (active_index <= 0 || active_index >= sku_count) {
					return false;
				}

				// 获取规格值
				var spec = [];
				for (var i in temp_data) {
					for (var k in temp_data[i]['value']) {
						if ((temp_data[i]['value'][k]['is_active'] || null) != null) {
							spec.push({
								"type": temp_data[i]['name'],
								"value": temp_data[i]['value'][k]['name']
							});
							break;
						}
					}
				}
				if (spec.length <= 0) {
					return false;
				}

				// 获取数据
				uni.request({
					url: app.globalData.get_request_url('spectype', 'goods'),
					method: 'POST',
					data: {
						id: this.goods_choose_data.id,
						spec: JSON.stringify(spec)
					},
					dataType: 'json',
					success: (res) => {
						if (res.data.code == 0) {
							var spec_type = res.data.data.spec_type;
							var spec_count = spec.length;
							var index = spec_count > 0 ? spec_count : 0;
							if (index < sku_count) {
								for (var i in temp_data) {
									for (var k in temp_data[i]['value']) {
										if (index == i) {
											temp_data[i]['value'][k]['is_dont'] = '';
											var temp_value = temp_data[i]['value'][k]['name'];
											var temp_status = false;
											for (var t in spec_type) {
												if (spec_type[t] == temp_value) {
													temp_status = true;
													break;
												}
											}
											if (temp_status == true) {
												temp_data[i]['value'][k]['is_disabled'] = '';
											} else {
												temp_data[i]['value'][k]['is_disabled'] =
													'spec-items-disabled';
											}
										}
									}
								}
								this.setData({
									goods_specifications_choose: temp_data
								});
							}
						} else {
							app.globalData.showToast(res.data.msg);
						}
					},
					fail: () => {
						app.globalData.showToast(this.$t('globalData.Server-request-error'));
					}
				});
			},

			// 获取规格详情
			get_goods_specifications_detail() {
				// 获取规格值
				var spec = this.goods_selected_spec();

				// 存在规格的时候是否已完全选择规格
				var sku_count = this.goods_specifications_choose.length;
				var active_count = spec.length;
				if (spec.length <= 0 || active_count < sku_count) {
					this.setData({
						goods_spec_base_price: this.goods_choose_data.price,
						goods_spec_base_original_price: this.goods_choose_data.original_price || 0,
						goods_spec_base_inventory: this.goods_choose_data.inventory
					});
					return false;
				}

				// 获取数据
				uni.request({
					url: app.globalData.get_request_url('specdetail', 'goods'),
					method: 'POST',
					data: {
						id: this.goods_choose_data.id,
						spec: JSON.stringify(spec),
						stock: 1
					},
					dataType: 'json',
					success: res => {
						if (res.data.code == 0) {
							this.goods_spec_detail_back_handle(res.data.data);
						} else {
							app.globalData.showToast(res.data.msg);
						}
					},
					fail: () => {
						app.globalData.showToast(this.$t('globalData.Server-request-error'));
					}
				});
			},

			// 已选的商品规格
			goods_selected_spec() {
				var spec = [];
				var temp_data = this.goods_specifications_choose;
				for (var i in temp_data) {
					for (var k in temp_data[i]['value']) {
						if ((temp_data[i]['value'][k]['is_active'] || null) != null) {
							spec.push({
								"type": temp_data[i]['name'],
								"value": temp_data[i]['value'][k]['name']
							});
							break;
						}
					}
				}
				return spec;
			},

			// 商品规格详情返回数据处理
			goods_spec_detail_back_handle(data) {
				var spec_base = data.spec_base;
				var data = {
					goods_spec_base_price: spec_base.price,
					goods_spec_base_original_price: spec_base.original_price || 0,
					goods_spec_base_inventory: parseInt(spec_base.inventory)
				};
				this.setData(data);
			},

			// 规格选择确认
			goods_spec_confirm_event(e) {
				var user = app.globalData.get_user_info(this, 'goods_spec_confirm_event');
				if (user != false) {
					// 用户未绑定用户则转到登录页面
					if (app.globalData.user_is_need_login(user)) {
						uni.navigateTo({
							url: "/pages/login/login?event_callback=goods_spec_confirm_event"
						});
						return false;
					} else {
						// 属性
						var temp_data = this.goods_specifications_choose;
						var sku_count = temp_data.length;
						var active_count = 0;
						var spec = [];
						if (sku_count > 0) {
							for (var i in temp_data) {
								for (var k in temp_data[i]['value']) {
									if ((temp_data[i]['value'][k]['is_active'] || null) != null) {
										active_count++;
										spec.push({
											"type": temp_data[i]['name'],
											"value": temp_data[i]['value'][k]['name']
										});
									}
								}
							}

							if (active_count < sku_count) {
								app.globalData.showToast(this.$t('goodsdetail.Select-specifications'));
								return false;
							}
						}

						// 数据操作处理
						if (this.buy_number_event_handle(1, this.goods_choose_data, spec)) {
							this.setData({
								popup_spec_status: false
							});
						}
					}
				}
			},

			// 规格图片查看
			goods_spec_base_images_view_event(e) {
				var value = e.currentTarget.dataset.value || null;
				if (value != null) {
					uni.previewImage({
						current: value,
						urls: [value]
					});
				}
			},

			// 批量删除操作
			cart_all_delete_event(e) {
				uni.showModal({
					title: this.$t('globalData.reminder'),
					content: this.$t('globalData.empty'),
					confirmText: this.$t('globalData.affirm'),
					cancelText: this.$t('globalData.Not-yet'),
					success: result => {
						if (result.confirm) {
							var ids = [];
							var temp_data = this.cart.data;
							for (var i in temp_data) {
								ids.push(temp_data[i]['id']);
							}
							this.cart_delete(ids.join(','));
						}
					}
				});
			},

			// 购物车状态
			cart_event(e) {
				this.setData({
					cart_status: !this.cart_status
				});
			},

			// 购物车结算
			buy_submit_event(e) {
				if (!app.globalData.is_single_page_check()) {
					return false;
				}

				// 获取购物车数据
				var ids = [];
				if ((this.cart || null) != null) {
					var temp_data = this.cart.data || [];
					for (var i in temp_data) {
						if (temp_data[i]['is_error'] == 0) {
							ids.push(temp_data[i]['id']);
						}
					}
				}
				if (ids.length <= 0) {
					app.globalData.showToast(this.$t('goodscategory.Please-select-product'));
					return false;
				}

				// 进入订单确认页面
				var data = {
					"buy_type": "cart",
					"ids": ids.join(',')
				};
				uni.navigateTo({
					url: '/pages/buy/buy?data=' + encodeURIComponent(JSON.stringify(data))
				});
			}
		}
	};
</script>
<style>
	@import './goods-category.css';
</style>